package com.wectrls.properties;

import com.google.common.collect.Lists;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;

/**
 * @author chenjian
 * @Package
 * @Description:
 * @date 2019/7/4 16:17
 */
@Configuration
@ConfigurationProperties(prefix = "system.roles.control")
public class RolesConfigProperties {

    /**
     * superAdmin
     */
    private List<String> superAdmin;

    /**
     * tenantAdmin
     */
    private List<String> tenantAdmin;

    public RolesConfigProperties() {
        superAdmin = Lists.newArrayList("TENANT_ADMIN");
        tenantAdmin = Lists.newArrayList();
    }

    public List<String> getSuperAdmin() {
        return superAdmin;
    }

    public void setSuperAdmin(String superAdmin) {
        String[] split = superAdmin.split(",");
        ArrayList<String> list = Lists.newArrayList();
        for (String s : split) {
            list.add(s.trim());
        }
        this.superAdmin = list;
    }

    public List<String> getTenantAdmin() {
        return tenantAdmin;
    }

    public void setTenantAdmin(String tenantAdmin) {
        String[] split = tenantAdmin.split(",");
        ArrayList<String> list = Lists.newArrayList();
        for (String s : split) {
            list.add(s.trim());
        }
        this.tenantAdmin = list;
    }
}
